<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>添加班级</title>
    <link rel="stylesheet" href="/static/css/pintuer.css">
    <link rel="stylesheet" href="/static/css/admin.css">
    <script src="/static/js/jquery.js"></script>
    <script src="/static/js/pintuer.js"></script>
<!--    <base href="${pageContext.request.contextPath}/">-->

</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-pencil-square-o"></span>添加班级</strong></div>
    <div class="body-content">
        <form class="form-clazz" action="/clazz/save" method="post">
            <div class="form-group">
                <div class="label">
                    <label>班级名称：</label>
                </div>
                <div class="field">
                    <input type="text" class="input" name="cname" id="cname" value="" style="width:30%"/>
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>班主任：</label>
                </div>
                <div class="field">
                    <input type="text" class="input" name="cteacher" id="cteacher" value="" style="width:30%"/>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label>备注：</label>
                </div>
                <div class="field">
                    <textarea type="text" class="input" name="remark" id="remark" style="height:80px;"></textarea>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <button id="btn" class="button bg-main icon-check-square-o" type="button"> 提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
</body>
<script>

    $('#btn').click(function () {
        console.log("click")
        $.ajax({
            url: "/clazz/save",
            data: {
                cname: $("#cname").val().trim(),
                cteacher: $("#cteacher").val().trim(),
                remark: $("#remark").val().trim()
            },
            type: "POST",
            dataType: "json",
            success: function (data) {
                if (data.code === 501) {
                    alert(data.msg);
                } else {
                    alert("添加成功");
                    $("#cname").val("");
                    $("#cteacher").val("");
                    $("#remark").val("");
                }
            },
            error: function (e) {
                console.log('错误信息', e)
            }
        })
    });

</script>
</html>